package pso;


public class Rastrigin extends BlackBoxFunction {

	public Rastrigin(int dimension) {
		super(new Point(dimension, -5.12), new Point(dimension, 5.12));
	}

	protected double evaluateHelper(Point p) {
		double acc = 10 * p.getDimension();
		for (double x : p.getCoordinates()){
			acc += (x*x - 10 * Math.cos(2 * Math.PI * x)); 
		}
		return acc;
	}

}
